define(function () {
    'use strict';

    function ctrl($scope,$stateParams,$ionicHistory,InfoService) {

        $scope.prod_id = $stateParams["prod_id"];

        $scope.$on('$ionicView.loaded', function() {
            init();
        });

        function init(){

            InfoService.getProdFiles($scope.prod_id).then(function(data){
                if(data && data.length > 0){
                    $scope.agreementList = data;
                }
            });

        }

        $scope.closeAgreementList = function(){
            $ionicHistory.goBack();
        };
    }

    ctrl.$inject = ['$scope','$stateParams','$ionicHistory','InfoService'];
    return ctrl;
});
